//
//  CircleView.m
//  MMLOOK
//
//  Created by dllo on 15/8/25.
//  Copyright (c) 2015年 武俊娥. All rights reserved.
//

#import "CircleView.h"


//创建一个上面是圆形，下面是lable的按钮
@interface CircleView ()

@property (nonatomic, retain)UIImageView *subImage;
@property (nonatomic, retain)UILabel *titleLable;

@end

@implementation CircleView

- (void)dealloc
{
    [_subImage release];
    [_titleLable release];
    [super dealloc];
}

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        self.userInteractionEnabled = YES;
        [self initionalView];
    }
    return self;
}

- (void)initionalView
{
    self.subImage = [[[UIImageView alloc] initWithFrame:CGRectMake(20 * OffWidth, 10 * OffHeight, 55 * OffWidth, 55 * OffHeight)] autorelease];
    
    [self addSubview:self.subImage];
    
    self.titleLable = [[[UILabel alloc] initWithFrame:CGRectMake(30 * OffWidth, _subImage.frame.size.height + _subImage.frame.origin.y + 5, 80 * OffWidth, 20 * OffHeight)] autorelease];
    self.titleLable.font = [UIFont fontWithName:@"Copperplate-bold" size:15 * OffHeight];
    self.titleLable.textColor = [UIColor grayColor];
    //self.titleLable.textAlignment = NSTextAlignmentCenter;
    [self addSubview:self.titleLable];
}

//等着网络图片传过来 然后赋值

- (void)setImage: (NSString *)name text: (NSString *)title
{
    [self.subImage setImage:[UIImage imageNamed:name]];
    
    self.titleLable.text = title;
    
}


- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
    NSObject *obj = (NSObject *)self.target;
    
    [obj performSelector:self.Action withObject:self];
}
@end
